<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_custom
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;
?>
<div id="hour_operation" class="hours">
	<p class="title">Hours of Operation:</p>
	<div class="hour_detail">
	<?php 
	echo $info->hours;
	$times = json_decode($info->times);
	$start =0; $end = 0;
	$new_value = true;
	foreach($times as $key=>$value){
		if($new_value){
			$start = $key;
			$time = $value;
			$new_value = false;
		}
		
		if($time != $value){
			if($end)
				echo '<p>'.ucfirst($start).' to '. $end .': '.$time.'</p>';
			else 
				echo '<p>'.ucfirst($start).': '.$time.'</p>';
			$start = $key;
			$time = $value;
			$end = '';
		}else{
			$end = $key;
		}
	}
	if($end)
		echo '<p>'.ucfirst($start).' to '. $end .': '.$time.'</p>';
	else
		echo '<p>'.ucfirst($start).': '.$time.'</p>';
	?>
	</div>
</div>
